const { Rule, LinValidator } = require('../../core/lin-validator-v2')

class testValidator extends LinValidator {
    constructor() {
        super()
        this.test1 = [
            new Rule('isInt', '需要传入正整数', {
                min: 1
            })
        ]
        this.test2 = this.test1
    }
    validateTest(vals) {

        const test1 = vals.body.test1
        const test2 = vals.body.test2

        if (test1 !== test2) {
            throw new Error('两个参数不一致')
        }
    }
}

class testTokenValidator extends LinValidator {
    constructor() {
        super()
        this.token = [
            new Rule('isOptional')
        ]
    }
}

module.exports = {
    testValidator,
    testTokenValidator
}
